package com.libraryWeb.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;


public final class DateUtil {
	
	 private static final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");

	//字符串转Util
    public static java.util.Date strToUtilDate(String str) {
        try {
            return sdf.parse(str);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return null;
    }
    
    //util转sql
    public static java.sql.Date utilToSql(java.util.Date date){
        return new java.sql.Date(date.getTime());
    }
    
    //util转字符串
    public static String toStr(java.util.Date bornDate){
        return sdf.format(bornDate);
    }
}
